﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics;
using Newtonsoft.Json;

namespace ConsoleApp1
{
    /// <summary>
    /// 
    /// </summary>
    internal class Class1
    {

        public void Test()
        {
            string file = @"d:\aaa\bbb\ccc.jpg";
            string file_name = Path.GetFileName(file);
            string path_name = Path.GetDirectoryName(file);

            Console.WriteLine(file);
            Console.WriteLine(file_name);
            Console.WriteLine(path_name);
        }

        public void Test2()
        {
            string media_id = "@adqwer";
            Hashtable htPara = new Hashtable()
            {
                {"msgtype", "image"},
                {
                    "image",
                    new Hashtable() {{"media_id", media_id},}
                }
            };

            string json = JsonConvert.SerializeObject(htPara);
            Console.WriteLine(json);
        }

        public void Test3()
        {
            string task_id = null;
            //string[] send_user_id_list = null;
            Newtonsoft.Json.Linq.JArray send_user_id_list = null;

            string okJson_submit = @"{
	""errcode"": 0,
	""errmsg"": ""已提交发送1人中的1人,ok"",
	""send_user_id_list"": [
		""manager7677"",""addr74543""
	],
	""task_id"": ""3048069225507""
}";


            long errcode_submit = -9999;
            string errmsg_submit = null;
            Hashtable ht_submit_a = JsonConvert.DeserializeObject<Hashtable>(okJson_submit);
            if (ht_submit_a != null)
            {
                if (ht_submit_a.ContainsKey("errcode"))
                {
                    errcode_submit = (long)ht_submit_a["errcode"];
                }
                if (ht_submit_a.ContainsKey("errmsg"))
                {
                    errmsg_submit = string.Format("{0}", ht_submit_a["errmsg"]);
                }
                if (ht_submit_a.ContainsKey("task_id"))
                {
                    task_id = string.Format("{0}", ht_submit_a["task_id"]);
                }
                if (ht_submit_a.ContainsKey("send_user_id_list"))
                {
                    send_user_id_list = (Newtonsoft.Json.Linq.JArray)ht_submit_a["send_user_id_list"];
                }
            }

            Debug.WriteLine("task_id="+task_id);
            Debug.WriteLine("send_user_id_list=" + send_user_id_list.Count.ToString());


        }

        public void Test4()
        {
            string status_user_idss = null;
            string[] user_id =
                string.Format("{0}", status_user_idss).Split(new string[] {","}, StringSplitOptions.RemoveEmptyEntries);
            if (user_id.Length > 0)
            {
                string s = user_id[0];
            }
        }

        public void Test5()
        {
            string file = @"D:\Studio\office-data-tools\projects\用NPOI从Excel读取工资表导出工资条图片\Tzx.Tools.Payroll_Images_Exe\bin\Debug\发送20240114\第004行_李慧珣Amy00390.jpg";
            string files = Path.GetFileName(file);
            Debug.WriteLine(files);
        }



    }
}
